﻿using System;

namespace Nardax.ServiceModel.Discovery
{
    public static class StringExtensions
    {
        public static bool MatchByPair(this string s, string value)
        {
            var pairs = value.Trim(new char[] { '/' }).Split('/');
            for (var i = 0; i < pairs.Length; i++)
            {
                var pair = String.Format("{0}/{1}", pairs[i], pairs[++i]);
                if (!s.Contains(pair))
                {
                    return false;
                }
            }
            return true;
        }
    }
}
